//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
// 			VisualNovelToolkit		     /_/_/_/_/_/_/_/_/_/.
// Copyright ©2013 - Sol-tribe.	/_/_/_/_/_/_/_/_/_/.
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
using UnityEngine;
using System.Collections;

public enum SceneNodeType{
	LEAF = 0,
	NODE,
	BG,
		
	NONE,
}

/// <summary>
/// Scene data holds the Scene Node Data Array.
/// </summary>
public class SceneData { 

	[ System.Serializable]	

	/// <summary>
   	/// Anything we want to store in the XML file, we define it here 
	/// </summary>
	public class SceneNodeData{		

		/// <summary>
		/// Game object name in hierarchy view.
		/// </summary>
		public string name = "";

		/// <summary>
		/// Parent game object name in hierarchy view.
		/// </summary>
		public string parentname = "";

		/// <summary>
		/// Obsolete Attribute.
		/// </summary>
		public SceneNodeType nodeType = SceneNodeType.NONE;
		
		public float posX = 0f;
		public float posY = 0f;
		public float posZ = 0f;
			
		public float rotX = 0f;
		public float rotY = 0f;
		public float rotZ = 0f;
			
		public float sclX = 1f;
		public float sclY = 1f;
		public float sclZ = 1f;
			
		/// <summary>
		/// if uiAtlasName is not empty and NGUISpriteFactory is attached to ViNoSceneManager ,
		/// then the object created in hierarchy view will be an UISprite. It is required that there is the UIAtlas prefab under Resources folder.
		/// </summary>
		public string uiAtlasName = "";

		/// <summary>
		/// Texture path under a Resources folder.
		/// if uiAtlasName is not empty , then this property will be meaning a sprite name.
		/// </summary>
		public string	texturePath = "";		
		public float	alpha = 0.1f;
		public bool	show = true;

		/// <summary>
		/// if true , make the texture (UISprite) pixel perfect.
		/// sclX , sclY and sclZ information is ignored. 
		/// </summary>
		public bool makePixelPerfect = true;
	}	
	
    // We have to define a default instance of the structure 	
   public SceneNodeData[] m_DataArray;
	
   public SceneData(){} 
		
	public SceneNodeData GetSceneNodeData( string key ){
		if( m_DataArray == null ){
			return null;	
		}
		
		for( int i=0;i<m_DataArray.Length;i++){
			if( m_DataArray[ i ].name.Equals( key ) ){
					return m_DataArray[ i ];
			}
		}
		return null;
	}


}